﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.XF
{
    class Class3
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age<=59)
            {
                da.Value = ppa.Amount * 0.08;
            }
        }

        public void Calc2(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age >= 60 && ppa.Age <= 74)
            {
                da.Value = ppa.Amount * 0.16;
            }
            else if (ppa.Age >= 75 && ppa.Age <= 87)
            {
                da.Value = ppa.Amount * 0.32;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Age == 88)
            {
                da.Value = ppa.Amount * 2.5;
                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                if (ppa.Age < 18)
                {
                    da.Value = ppa.TotalFee;
                    da.Description = "无息退还你所交的保费";
                    

                }
                else if (ppa.Age >= 18)
                {

                    double v1 = ppa.Amount * 2.5;
                    double v2 = ppa.TotalFee - ppa.GetDutyTotalValue("生存保险金") + ppa.GetDutyTotalValue("养老保险金");

                    double p = ppa.GetDutyTotalValue("生存保险金") + ppa.GetDutyTotalValue("养老保险金");

                    da.Value = v1 > v2 ? v1 : v2;

                }
                ppa.IsCurrentFinish = true;
            }
        }
    }
}
